<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<html>
<head>
<title>报销申请信息</title>
<link rel="stylesheet" type="text/css" href="${ctx}/styles/ec/ecside_style.css" />
<%@include file="/common/meta.jsp"%>
<style type="text/css">

.budgetTable {
	margin: auto;
	border-top: 1px solid #000000;
	border-left: 1px solid #000000;
	border-bottom: -1px solid #000000;
	border-right: -1px solid #000000;
	margin-top: 5px;
}

.budgetTable tr td {
	height:25px;
	border-bottom: 1px solid #000000;
	border-right: 1px solid #000000;
	font-family: sans-serif;
}

.budgetTable tr th {
	background-color: #ECECEC;
	height:30px;
 	font-weight: bold;
 	font-size:13px;
 	text-align: center;
	border-bottom: 1px solid #000000;
	border-right: 1px solid #000000;
	font-family: sans-serif;
}
</style>
<script type="text/javascript">
function closeWin() {
	window.close();
}
</script>
<script language="javascript" src="${ctx}/pages/rbcs/print/CheckActivX.js"></script>
<object id="LODOP" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0> </object> 
</head>
<body>
<script language="javascript">CheckLodop();</script>
<div id="tableData" class="x-panel" style="width: 100%">
<div style="margin: 5px; font-family: sans-serif; font-size: 14px; text-align: left;">
	<s:hidden name="model.id" />
    <table width="891" class="budgetTable" cellpadding="0" cellspacing="0" >
		<tr> 
           <th class="title" colspan="6">报销单</th>
        </tr>	
        <tr> 
           <td align="right" width="200">报销单号：</td>
           <td align="left" >&nbsp;${model.singleNo}</td>
           <td align="right">部门名称：</td>
           <td align="left" width="160">&nbsp;${model.dept.name}</td>	 			
           <td align="right" >制单日期：</td>
           <td align="left" >&nbsp;<s:date name="model.createDate" format="yyyy-MM-dd HH:mm"/></td>		
        </tr>         
 
        <tr> 
           <td align="right" >项目类别：</td>
           <td align="left">&nbsp;${model.project.projectType.name}</td>
           <td align="right">项目名称：</td>
           <td align="left" colspan="3">&nbsp;${model.project.name}</td>	 				
        </tr>  
        <s:if test="model.singleType == 0 || model.singleType == 1">        
        <tr> 
           <td align="right">销账金额：</td>
           <td align="left">&nbsp;<span style="color: green;">${model.borrowAmount}</span></td>
           <td align="right" >余&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;款：</td>
           <td align="left" colspan="3">&nbsp;<span style="color: green;">${model.balance}</span></td>					
        </tr>	
   
         <tr align="right"> 
           <td align="right" >销账借款单号：</td>
           <td align="left" colspan="5">&nbsp;${model.totalBorrowNos}</td>				
         </tr>
        
         <tr align="right"> 
           <td align="right" >部分销账借款单号：</td>
           <td align="left" colspan="5">&nbsp;${model.partBorrowNos}</td>			
         </tr> 
         </s:if>                   	
	</table>
</div>
<s:if test="model.singleType == 0 || model.singleType == 2">
<div style="margin: 5px; font-family: sans-serif; font-size: 14px; text-align: left;">
  <table width="891" class="budgetTable" cellpadding="0" cellspacing="0">
    <tr>
      <!--  
      <th colspan="6" class="title">
           <div align="center" style="float: center;margin-top: 6px;font-weight: bold;font-size:13px;">报销单明细</div>
           <div align="right" style="float: right;font-size:13px; font-weight: normal;" >[总额:${model.amount}]</div>
      </th>
      -->
      <th colspan="6" class="title">报销单明细</th>
    </tr>
    <tr>
      <th width="40">No.</th>
      <th width="160">科目名称</th>
      <th width="302">摘要</th>
      <th width="100">金额</th>
      <th width="90">外币金额</th>
      <th width="92">外币币种</th>
    </tr>
    <s:iterator value="model.reimbDetail" var="rd" status="start">
    <tr>
      <td align="center">${start.index + 1}</td>
      <td>&nbsp;${rd.item.name}【${rd.item.code}】</td>
      <td>&nbsp;${rd.title}</td>
      <td align="right">&nbsp;${rd.amount}</td>
      <td align="right">&nbsp;${rd.exchangeAmount}</td>
      <td align="center">
	    <s:if test='#attr.rd.currency != null'>
	      &nbsp;${rd.currency.name}
	    </s:if>&nbsp;
      </td>
    </tr>
    </s:iterator>
    <tr>
      <td colspan="3" align="right">合计金额：</td>
      <td align="right">&nbsp;${model.amount}</td>
      <td colspan="2">&nbsp;</td>
    <tr>
  </table>
</div>
<div style="margin: 5px; font-family: sans-serif; font-size: 14px; text-align: left;">
  <table width="891" class="budgetTable" cellpadding="0" cellspacing="0">
    <tr>
      <th colspan="6" class="title">报销审核状态</th>
    </tr>
    <tr>
      <th width="40">No.</th>
      <th width="160">审核部门</th>
      <th width="100">审核人</th>
      <th width="100">审核日期</th>
      <th width="100">审核状态</th>
      <th width="284">审核意见</th>
    </tr>
    <s:iterator value="model.topFlow.nodes" var="node">
    <tr>
      <td align="center">${node.orderId}</td>
      <td>
        &nbsp;
        <s:if test="#attr.node.isFinance eq 0">
            <s:if test="#attr.node.dept != null">
	        ${node.dept.name}
	        </s:if>
	        <s:else>
	                           项目审核
	        </s:else>
        </s:if>
        <s:else>
        	<i>财务部</i>
        </s:else>
      </td>
      <td>&nbsp;${node.auditor.name}</td>
      <td>&nbsp;<s:date name="#attr.node.audDate" format="yyyy/MM/dd HH:mm"/></td>
      <td align="center">
	    <s:if test='#attr.node.status == "nopass"'>
	      <span style="color: red;">未通过</span>
	    </s:if>
	    <s:elseif test='#attr.node.status == "pass"'>
	      <span style="color: green;">通过</span>
	    </s:elseif>
	    <s:else>
	      <span style="color: silver;">未审核</span>
	    </s:else>&nbsp;
      </td>
      <td>&nbsp;${node.descn}</td>
    </tr>
    </s:iterator>
  </table>
</div>
</s:if>

<s:if test="model.singleType == 1">
<div style="margin: 5px; font-family: sans-serif; font-size: 14px; text-align: left;">
  <table width="891" class="budgetTable" cellpadding="0" cellspacing="0" >
    <tr>
      <!--
      <th colspan="6" class="title">
           <div align="center" style="float: center;margin-top: 6px;font-weight: bold;">报销子单信息</div>
           <div align="right" style="float: right;font-size:13px; font-weight: normal;" >[总额:${model.amount}]</div>
      </th>
      -->
      <th colspan="6" class="title">报销子单信息</th>
    </tr>
    <tr>
      <th width="40">No.</th>
      <th width="160">报销单号</th>
      <th width="162">部门名称</th>
      <th width="240">项目名称</th>
      <th width="90">制单时间</th>
      <th width="92">报销金额</th> 
    </tr>
    <s:iterator value="model.childReimbs" var="childReimb" status="start">
    <tr>
      <td align="center">${start.index + 1}</td>
      <td>&nbsp;<a href="view.do?model.id=${childReimb.id}" target="_blank"><font color="blue">${childReimb.singleNo}</font></a></td>
      <td>&nbsp;${childReimb.dept.name}</td>
      <td align="left">
	    <s:if test='#attr.childReimb.project != null'>
	      &nbsp;${childReimb.project.name}
	    </s:if>&nbsp;
      </td>
      <td align="center"">&nbsp;<s:date name="#attr.childReimb.createDate" format="yyyy-MM-dd "/></td>
      <td align="right">&nbsp;${childReimb.amount}</td>
    </tr>
    </s:iterator>
    <tr>
      <td colspan="5" align="right">合计金额：</td>
      <td align="right">&nbsp;${model.amount}</td>
    <tr>
  </table>
</div>
</s:if>
</div>
<table width="891" style="margin-bottom: 10px;">
<tr>
	<td style="text-align: center;">
    <a href="#" onclick="AllAreaExcel()" class="button" style="width: 80px;height: 25px;">Excel导出</a>&nbsp;&nbsp;		
    <a href="#" onclick="prn1_preview()" class="button" style="width: 60px;height: 25px;">打印</a>&nbsp;&nbsp;
    <a href="#" onclick="closeWin()" class="button" style="width: 60px;height: 25px;">关闭</a>
	</td>
</tr>
</table>

<script type="text/javascript">
function prn1_preview() {	
	CreateOneFormPage();	
	LODOP.PREVIEW();	
};

function CreateOneFormPage(){
	//LODOP.PRINT_INIT("打印插件功能演示_Lodop功能_表单一");
	//LODOP.ADD_PRINT_TEXT(50,231,260,39,"打印页面部分内容");
	//LODOP.SET_PRINT_STYLE("FontSize", 9);
	//LODOP.SET_PRINT_TEXT_STYLE(100,"宋体",0,0,0,0,0);
	//LODOP.ADD_PRINT_HTM(10,100,500,600,document.getElementById("form1").innerHTML);
	var strBodyStyle = "<style><!--table tr td {border: 1 solid #000000} table tr th {border: 1 solid #000000}--></style>";
	var strFormHtml = strBodyStyle + "<body>" + document.getElementById("tableData").innerHTML + "</body>";
	//LODOP.ADD_PRINT_TEXT(50,50,260,39,"另外样式打印：");
	LODOP.ADD_PRINT_HTM(10,100,500,600,strFormHtml);
	
};

function AllAreaExcel() {
	if (!confirm('是否要导出到Excel?')) {
		return;
	}
	try {
		var oXL = new ActiveXObject("Excel.Application");
		var oWB = oXL.Workbooks.Add();
		var oSheet = oWB.ActiveSheet;
		var sel = document.body.createTextRange();
		sel.moveToElementText(tableData);
		sel.select();
		sel.execCommand("Copy");
		oSheet.Paste();
		oXL.Visible = true;
	} catch (e) {
		alert("1.Excel导出没有成功.\n\n" + 
			  "2." + e.message + ".\n\n" +
			  "3.您的电脑可能没有安装Microsoft Excel软件.\n\n" + 
			  "4.请设置Internet选项自定义级别,对没有标记安全级别的 ActiveX控件进行提示.");
	}
}

function doPrint(){ 
	window.print(); 
}
</script>
</body>
</html>